#ifndef UTILITY_H
#define UTILITY_H
#include <vector>
#include <exception>
#include "Include.h"

namespace Utility {
    vector <RooDataHist *> createRooDataHistVector(string prefix, vector <TH1D *> histVector, RooRealVar & isol, GarbageCollector * gc);
    vector <RooHistPdf *> createRooHistPdfVector(string prefix, vector <RooDataHist *> dataHistVector, RooRealVar & isol, GarbageCollector * gc);
    vector <RooRealVar *> createRooRealVarVector(string prefix, int il, GarbageCollector * gc, double val, double low, double high);
    RooAddPdf * createRooPdfAsSum(string name, vector <RooHistPdf *> sigHistPdfVector, vector <RooHistPdf *> bgdHistPdfVector, vector <RooRealVar *> sigVars, vector <RooRealVar *> bgdVars, GarbageCollector * gc);
    void addToStats(TPaveText & stats, RooRealVar & var);
    void addStartingValueToStats(TPaveText & stats, RooRealVar & var);
}

class UtilityException : public std::exception {
    string desc;
    public:
    UtilityException(string _desc) {
        desc=_desc;
    }
    virtual const char * what() const throw() {
        return desc.c_str();
    }
    ~UtilityException() throw () {}
};

#endif
